Return to RingdateR Help webpage
RingdateR is designed to facilitate visual and statistical crossdating of tree ring and growth increment width series of both live- and dead-collected samples. RingdateR has a particular focus on facilitating the crossdating of dead-collected samples, with unknown antiquities, either against each other (i.e. pairwise analysis) or an existing absolutely dated chronology. As RingdateR is a crossdating application, it has not been designed for the construction of chronologies and as such does not contain facilities for performing regional curve standardisation or signal free detrending or more sophisticated tools for combining data sets into robust mean chronologies. The tools set out in RingdateR are designed to facilitate the evaluation of growth patterns in annually resolved archives to facilitate the dating of samples either relative to each other, or relative to an existing mean chronology.
Before using any of the RingdateR functions, you will need to install the package from the CRAN library.
You will also need to load the package.
library(ringdater)
RingdateR is compatable with an array of file formats including: csv, txt (tab delimitted), MS Excel, pos (cooRecorder), and lps (ImagePro). Loading series of any format follows a similar procedure:
###Example data can be downloaded from a GitHub repository at the following URL:
https://github.com/davidjreynolds/ringdater.git
After unzipping the example data to a known location, you can proceed to load the data into R using various data loading functions.
For other file loading methods (.xlsx, .pos, .lps, .txt), see the ringdateR Pairwise Vignette
###Load an undated series file (csv)
undated <- load_undated("example_data/example_data/UndatedSeries.csv")
undated <- normalise(the.data = undated, detrending_select = 3, splinewindow = 21)
###Load a chronology file (csv)
chronoData <- load_chron("example_data/example_data/chronologies/ExampleChron.csv")
chronoData<-normalise(chronoData, detrending_select = 3, splinewindow = 21)
chronoData<-data.frame(chronoData[,1], rowMeans(chronoData[,-1], na.rm = TRUE))
colnames(chronoData)<-c("year","chronoData")
plot(chronoData, type ="l", xlab = "Year", ylab = "Standardised growth index")
###Combine the chronology and undated series into a single data frame for analysis
chron_n_series <- comb.NA(chronoData, undated[,-1], fill = NA)
year | chronoData | x021a | x021b | x022a | x022b |
---|---|---|---|---|---|
1623 | 1.2183931 | 1.0415758 | 1.2362986 | 1.0034727 | 1.0510192 |
1624 | 0.9125061 | 0.9455410 | 1.1501913 | 1.0936668 | 1.0559488 |
1625 | 0.8987077 | 0.6701674 | 0.8154175 | 0.9310488 | 0.9711036 |
1626 | 1.0781337 | 1.2813663 | 1.0376348 | 1.0880688 | 1.0523919 |
1627 | 1.0313786 | 1.3392096 | 1.0777262 | 0.7265489 | 0.6907749 |
1628 | 0.9470672 | 1.1478290 | 0.6616694 | 0.7572327 | 0.8545623 |
chron_comp <- lead_lag_analysis(the_data = chron_n_series, mode = 2, neg_lag = -20, pos_lag = 20, complete = TRUE, shiny = FALSE)
Series #1 | Series #2 | First ring | Last ring | col | 1st lag (years) | 1st R | 1st P | 1st Overlap | 2nd lag (years) | 2nd R | 2nd P | 2nd Overlap | 3rd lag (years) | 3rd R | 3rd P | 3rd Overlap | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | chronoData | x021a | 1691 | 1737 | 3 | 68 | 0.8107153 | 0.00e+00 | 47 | -8 | 0.4370690 | 1.2744237 | 39 | 29 | 0.3782875 | 2.0642384 | 47 |
3 | chronoData | x021b | 1681 | 1737 | 4 | 58 | 0.7979802 | 0.00e+00 | 57 | 2 | 0.3374854 | 2.4187549 | 57 | -48 | 0.7391133 | 5.4003308 | 9 |
4 | chronoData | x022a | 1646 | 1706 | 5 | 23 | 0.7874771 | 0.00e+00 | 61 | -33 | 0.5313429 | 0.8541737 | 28 | 106 | 0.7247988 | 1.8076300 | 12 |
5 | chronoData | x022b | 1646 | 1705 | 6 | 23 | 0.7850611 | 0.00e+00 | 60 | 106 | 0.7347057 | 1.5327704 | 12 | -33 | 0.4966007 | 1.9863649 | 27 |
6 | chronoData | x023a | 1583 | 1676 | 7 | -40 | 0.7228908 | 2.00e-07 | 54 | 66 | 0.3993570 | 0.7925143 | 52 | 67 | 0.3980043 | 0.9022636 | 51 |
7 | chronoData | x023b | 1583 | 1665 | 8 | -40 | 0.7082025 | 2.55e-05 | 43 | 67 | 0.4068496 | 0.7194823 | 51 | 50 | 0.3384234 | 1.1235796 | 68 |
8 | chronoData | x024a | 1625 | 1675 | 9 | 2 | 0.7795288 | 0.00e+00 | 51 | 77 | 0.4037758 | 2.0874272 | 41 | 71 | 0.3640842 | 2.8025593 | 47 |
9 | chronoData | x024b | 1624 | 1675 | 10 | 1 | 0.7824672 | 0.00e+00 | 52 | 70 | 0.3688737 | 2.3319896 | 48 | 76 | 0.3664545 | 4.0096957 | 42 |
Examine one of the undated series plotted against the chronology at the strongest lag position
line_plot(the_data = chron_n_series, series_1 = "chronoData", series_2 = "x021b", lag = 58)
Examine the lead-lag results between the two samples as a bar chart
lead_lag_bar(the_data = as.data.frame(chron_comp[2]), sample_1 = "chronoData", sample_2 = "x021b")
The heatmap provides an additional visual tool for assessing the crossdating. The sample numbers come from the column positions of the samples: the chronology is sample 2 and “x021b” is sample 4.
“center” defines the midpoint (in the y direction) of the plot region “neg_lag” and “pos_leg” set the y-limits of the plot relative to the midpoint “complete”, when set to TRUE, overrides plot position details and returns the full plot “leg_size” defines the size of the legend
heatmap_analysis(the_data = chron_n_series, s1 = "chronoData", s2 = "x021b", neg_lag = -10, pos_lag = 10, center = 58, complete = FALSE, leg_size = 1)
First we can filter the pairwise data by r-value, p-value, overlap, and sample ID.
filtered_data <- filter_crossdates(the_data = as.data.frame(chron_comp[1]), r_val = 0.6, p_val = 0.05, overlap = 40, target = colnames(chron_n_series)[2])
Series..1 | Series..2 | First.ring | Last.ring | col | X1st.lag..years. | X1st.R | X.1st.P | X1st.Overlap | |
---|---|---|---|---|---|---|---|---|---|
2 | chronoData | x021a | 1691 | 1737 | 3 | 68 | 0.811 | 0.00e+00 | 47 |
3 | chronoData | x021b | 1681 | 1737 | 4 | 58 | 0.798 | 0.00e+00 | 57 |
4 | chronoData | x022a | 1646 | 1706 | 5 | 23 | 0.787 | 0.00e+00 | 61 |
5 | chronoData | x022b | 1646 | 1705 | 6 | 23 | 0.785 | 0.00e+00 | 60 |
6 | chronoData | x023a | 1583 | 1676 | 7 | -40 | 0.723 | 2.00e-07 | 54 |
7 | chronoData | x023b | 1583 | 1665 | 8 | -40 | 0.708 | 2.55e-05 | 43 |
We can now align and plot all of the data that meets the criterea set above.
aligned_data <- align_series(the_data = chron_n_series, cross_dates = filtered_data, sel_target = colnames(chron_n_series)[2])
plot_all_series(aligned_data)
Correlations between each sample and the arithemtic mean chronology with replacement.
alignmentStats <- correl_replace(aligned_data)
Series ID | First Ring | Last ring | R value | P value | Overlap with chronology | |
---|---|---|---|---|---|---|
cor1 | x021a | 1691 | 1737 | 0.7029867 | 0 | 47 |
cor2 | x021b | 1681 | 1737 | 0.8038771 | 0 | 57 |
cor3 | x022a | 1646 | 1706 | 0.8329737 | 0 | 61 |
cor4 | x022b | 1646 | 1705 | 0.8176763 | 0 | 60 |
cor5 | x023a | 1583 | 1676 | 0.8511804 | 0 | 94 |
cor6 | x023b | 1583 | 1665 | 0.8640576 | 0 | 83 |
cor7 | x024a | 1625 | 1675 | 0.8091598 | 0 | 51 |
cor8 | x024b | 1624 | 1675 | 0.8052860 | 0 | 52 |